/**
 * 职位标签
 * @author luguoxiang
 * @date 2025-08-14
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { BaseEntity, IConfigSchema, LgDictProps } from '@/soar';
import { basePath } from './api';
import { MenuComponent } from '@/types/interface';

export interface PostTag extends BaseEntity {
  /** 主键 */
  id?: any;
  /** 创建人 */
  createBy?: any;
  /** 更新人 */
  updateBy?: any;
  /** 创建时间 */
  createTime?: any;
  /** 更新时间 */
  updateTime?: any;
  /** 编码 */
  code?: any;
  /** 名称 */
  name?: any;
  /** 描述 */
  description?: any;
  /** 状态(0正常，1禁用) */
  status?: any;
}

const fieldList: IConfigSchema<PostTag>[] = [
  {
    field: 'code',
    label: '编码',
    dataType: 'string',
    form: {
      rules: true,
    },
  },
  {
    field: 'name',
    label: '名称',
    dataType: 'string',
    form: {
      rules: true,
    },
  },
  {
    field: 'description',
    label: '描述',
    dataType: 'string',
  },
  {
    field: 'status',
    label: '状态',
    dataType: 'dict',
    params: 'DataStatusEnum',
    form: {
      rules: true,
      componentProps: {
        component: 't-radio-group',
      } as LgDictProps,
    },
  },
];

export default fieldList;

/**
 * 组件配置（用于生成菜单数据）
 */
export const COMPONENTS: MenuComponent[] = [
  {
    title: '职位标签',
    component: () => import('./List.vue'),
    sort: 80,
    keepalive: true,
    icon: 'tag',
    permits: [`GET${basePath}/query`],
    elements: [
      { title: '新增', code: 'create', permits: [`POST${basePath}/create`] },
      { title: '更新', code: 'update', permits: [`POST${basePath}/update`, `GET${basePath}/detail`] },
      { title: '删除', code: 'remove', permits: [`POST${basePath}/remove`] },
      { title: '详情', code: 'detail', permits: [`GET${basePath}/detail`] },
      { title: '导入', code: 'import', permits: [`POST${basePath}/import`] },
      { title: '导出', code: 'export', permits: [`GET${basePath}/export`] },
    ],
  },
];
